package com.ykq.controller;

import com.ykq.service.StaffService;
import com.ykq.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: qy145-key
 * @description:
 * @author: 闫克起2
 * @create: 2021-12-16 10:27
 **/
@RestController  // @ResponseBody+@Contoller 该类中所有的方法必须是json格式
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private StaffService staffService;

    @PostMapping("/login") //只能接受post请求
    public CommonResult login(String username,String password){
        return staffService.findByUsernameAndPassword(username,password);
    }
}
